get_{$adjacent}_post_join
Filter HookDescription
Filters the JOIN clause in the SQL for an adjacent post query. The dynamic portion of the hook name, `$adjacent`, refers to the type of adjacency, 'next' or 'previous'. Possible hook names include: - `get_next_post_join` - `get_previous_post_join`Hook Information
File Location |
wp-includes/link-template.php
View on GitHub
|
Hook Type | Filter |
Line Number | 1961 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$join
|
The JOIN clause in the SQL. |
bool
|
$in_same_term
|
Whether post should be in the same taxonomy term. |
int[]|string
|
$excluded_terms
|
Array of excluded term IDs. Empty string if none were provided. |
string
|
$taxonomy
|
Taxonomy. Used to identify the term used when `$in_same_term` is true. |
WP_Post
|
$post
|
WP_Post object. |
Usage Examples
Basic Usage
<?php
// Hook into get_{$adjacent}_post_join
add_filter('get_{$adjacent}_post_join', 'my_custom_filter', 10, 5);
function my_custom_filter($join, $in_same_term, $excluded_terms, $taxonomy, $post) {
// Your custom filtering logic here
return $join;
}
Source Code Context
wp-includes/link-template.php:1961
- How this hook is used in WordPress core
<?php
1956 * @param bool $in_same_term Whether post should be in the same taxonomy term.
1957 * @param int[]|string $excluded_terms Array of excluded term IDs. Empty string if none were provided.
1958 * @param string $taxonomy Taxonomy. Used to identify the term used when `$in_same_term` is true.
1959 * @param WP_Post $post WP_Post object.
1960 */
1961 $join = apply_filters( "get_{$adjacent}_post_join", $join, $in_same_term, $excluded_terms, $taxonomy, $post );
1962
1963 /**
1964 * Filters the WHERE clause in the SQL for an adjacent post query.
1965 *
1966 * The dynamic portion of the hook name, `$adjacent`, refers to the type
PHP Documentation
<?php
/**
* Filters the JOIN clause in the SQL for an adjacent post query.
*
* The dynamic portion of the hook name, `$adjacent`, refers to the type
* of adjacency, 'next' or 'previous'.
*
* Possible hook names include:
*
* - `get_next_post_join`
* - `get_previous_post_join`
*
* @since 2.5.0
* @since 4.4.0 Added the `$taxonomy` and `$post` parameters.
*
* @param string $join The JOIN clause in the SQL.
* @param bool $in_same_term Whether post should be in the same taxonomy term.
* @param int[]|string $excluded_terms Array of excluded term IDs. Empty string if none were provided.
* @param string $taxonomy Taxonomy. Used to identify the term used when `$in_same_term` is true.
* @param WP_Post $post WP_Post object.
*/
Quick Info
- Hook Type: Filter
- Parameters: 5
- File: wp-includes/link-template.php
Related Hooks
Related hooks will be displayed here in future updates.